package ca.etsmtl.log430.lab3.presentation;

import java.util.HashMap;

/**
 * This class is used to parse paramter given in a PARAM_NAME=VALUE format.. 
 * 
 * @author samuel
 *
 */
public class ParameterParser {
	public static String COURSEFILE_PARAM = "courseFile";
    public static String TEACHERFILE_PARAM = "teacherFile";

    /**
     * Return a HashMap containing value with parameter name as key. 
     * 
     * 
     * @param args
     * @return
     */
    public static HashMap<String,String> parse(String[] args)
    {
    	HashMap<String, String> arguments= new HashMap<String, String>();
		if (args.length != 2) 
		{
			System.out.println("\n\nIncorrect number of input parameters -"
					+ " correct usage:");
			System.out.println("\njava TeacherAssignment <course file name>"
					+ " <teacher file name>");
		} 
		else 
		{
			for (String string : args) {
				String[] element = string.split("=");
				arguments.put(element[0], element[1]);
			};
			
		}
		
		
		return arguments;
    }
}
